package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.DamageListDao;
import com.atguigu.jxc.dao.UserDao;
import com.atguigu.jxc.entity.DamageList;
import com.atguigu.jxc.entity.User;
import com.atguigu.jxc.service.DamageListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DamageListServiceImpl implements DamageListService {

    @Autowired
    private DamageListDao damageListDao;

    @Autowired
    private UserDao userDao;
    @Override
    public List<DamageList> selectByTime(String sTime, String eTime) {
        List<DamageList> lists=damageListDao.selectByTime(sTime,eTime);
        for (DamageList list : lists) {
            User userById = userDao.getUserById(list.getUserId());
            list.setTrueName(userById.getTrueName());
        }
        return lists;

    }
}
